	<div class="row">
	    <div class="col-xs-12">
	        <div class="box box-primary">
	            <div class="box-header">
                <h3 class="box-title">Surat Jaminan</h3>
                <span class="box-title tmb-title">
                	<!-- <a href="<?php echo site_url('persetujuan_jaminan/add')?>" class="btn btn-xs btn-primary btn-flat"><i class="ion-plus-round"></i>&nbsp;&nbsp;Tambah</button></a> -->
                </span>
	            </div><!-- /.box-header -->
	            <div class="box-body box-export-tools">
	            	<span class="notif notif-primary" <?php if(is_string($this->session->flashdata('sukses'))){echo 'style="display:block;"';}else{echo 'style="display:none;"';}?>>
	            		<i class="fa fa-check"></i>
	            		<?php echo $this->session->flashdata('sukses'); ?>
	            		<button type="button" class="close">&times;</button>
	            	</span>

	            	<span class="notif notif-danger" <?php if(is_string($this->session->flashdata('gagal'))){echo 'style="display:block;"';}else{echo 'style="display:none;"';}?>>
	            		<i class="fa fa-check"></i>
	            		<?php echo $this->session->flashdata('gagal'); ?>
	            		<button type="button" class="close">&times;</button>
	            	</span>

	            	<?=form_open('persetujuan_jaminan/cari')?>
	            	<div class="row">
	            		<div class="col-sm-4">
									  <div class="form-group">
									    <label>Tanggal Awal</label>
									    <input type="text" name="tgl_awal" value="<?=$this->session->userdata('tgl_awal');?>" class="form-control input-sm" id="tgl_awal" size="15" placeholder="Tanggal Awal">
									  </div>
									  <div class="form-group">
									    <label>Tanggal Akhir</label>
									    <input type="text" name="tgl_akhir" value="<?=$this->session->userdata('tgl_akhir');?>" class="form-control input-sm" id="tgl_akhir" size="15" placeholder="Tanggal Akhir">
									  </div>
									</div>
									<div class="col-sm-4">
									  <div class="form-group">
									    <label>Jenis Kunjungan</label>
									    <select name="jenis_kunjungan" class="form-control input-sm" id="jenis_kunjungan">
									    	<option value=""> - - Pilih Jenis Kunjungan - - </option>
									    	<?php
									    		foreach ($jenis_kunjungan as $value) {
									    			if($value['id_jenis_kunjungan'] == $this->session->userdata('jenis_kunjungan')){
									    				$s = "selected";
									    			}else{
									    				$s = "";
									    			}
									    			echo "<option value=".$value['id_jenis_kunjungan']." $s>".$value['jenis_kunjungan']."</option>";
									    		}
									    	?>
									    </select>
									  </div>
									  <div class="form-group">
									    <label>Petugas</label>
									    <select name="petugas" class="form-control input-sm" id="petugas">
									    	<option value=""> - - Pilih Petugas - - </option>
									    	<?php
									    		foreach ($petugas as $value) {
									    			if($value['id'] == $this->session->userdata('petugas_loket')){
									    				$s = "selected";
									    			}else{
									    				$s = "";
									    			}
									    			echo "<option value=".$value['id']." $s>".$value['nickname']."</option>";
									    		}
									    	?>
									    </select>
									  </div>
									</div>
									<div class="col-sm-4">
									  <div class="form-group">
									    <label>Status</label>
									    <select name="status" class="form-control input-sm" id="status">
									    	<option value=""> - - Pilih Status - - </option>
									    	<?php
									    		if($this->session->userdata('status') == 'Diterima'){
								    				$sd = "selected";
								    				$st = "";
								    				$sp = "";
								    			}else if($this->session->userdata('status') == 'Ditolak'){
								    				$sd = "";
								    				$st = "selected";
								    				$sp = "";
								    			}else if($this->session->userdata('status') == 'Pending'){
								    				$sd = "";
								    				$st = "";
								    				$sp = "selected";
								    			}else{
								    				$sd = "";
								    				$st = "";
								    				$sp = "";
								    			}
									    	?>
									    	<option <?php echo $sd; ?>>Diterima</option>
									    	<option <?php echo $st; ?>>Ditolak</option>
									    	<option <?php echo $sp; ?>>Pending</option>
									    </select>
									  </div>
									  <div class="form-group">
									    <label>Kata Kunci</label>
									    <input type="text" name="keyword" value="<?=$this->session->userdata('keyword');?>"class="form-control input-sm" placeholder="Cari nama/kode jaminan...">
									  </div>
									  <div class="form-group">
									    <button type="submit" name="submit" class="btn btn-sm btn-primary btn-flat pull-right"><i class="fa fa-search"></i> Cari</button>
									  </div>
									</div>
								</div>
								<?=form_close();?>
								<div class="table-responsive">
		            	<div class="pull-right">
			            	<!-- <a href="<?php echo site_url('surat_jaminan/excel')?>" class="btn btn-xs btn-tbl btn-flat"><i class="fa fa-file-excel-o"></i>&nbsp;&nbsp;Save as Excel</button></a> -->
		                <!-- <a href="<?php echo site_url('surat_jaminan/pdf')?>" target="_blank" class="btn btn-xs btn-tbl btn-flat"><i class="fa fa-file-pdf-o"></i>&nbsp;&nbsp;Save as PDF</button></a>  	 -->
	                </div>
	                <br>
	                <table class="table table-hover table-condensed table-striped">
										<thead>
										<tr>
											<th style="text-align:center;" width="3%">#</th>
											<th width="10%">Kode Jaminan</th>
											<th width="5%">Status</th>
											<th width="10%">Tanggal</th>
											<th width="15%">Nama Pasien</th>
											<th width="20%">Alamat</th>
											<th width="15%">Jenis Kunjungan</th>
											<th width="10%">Petugas</th>
											<!-- <th>Diagnosa</th> -->
											<th></th>
										</tr>
										</thead>
										<?php 
											if(!empty($results)){
												foreach ($results as $row) {
													?>
													<tr>
														<td align="center"><?php echo $ordinal_num++ ?></td>
														<td><?php echo $row['kd_surat_jaminan']?></td>
														<td>
															<?php 
																if($row['status_jaminan'] == 'Diterima'){
																	echo "<span class='label label-success'>Diterima</span>";
																}else if($row['status_jaminan'] == 'Ditolak'){
																	echo "<span class='label label-danger'>Ditolak</span>";
																}else{
																	echo "<span class='label label-warning'>Pending</span>";
																}
															?>
														</td>
														<td><?php echo id_date($row['tgl_surat'])?></td>
														<td><?php echo $row['nama']?></td>
														<td><?php echo $row['alamat']?></td>
														<td><?php echo $row['jenis_kunjungan']?></td>
														<td><?php echo $row['nickname']?></td>
														<td>
															<span class="pull-right">
																<?php echo anchor('persetujuan_jaminan/detail/'.$row['kd_surat_jaminan'].'','Lihat','class="label label-primary" title="Lihat data surat jaminan"'); ?>
																<?php echo anchor('persetujuan_jaminan/persetujuan/'.$row['kd_surat_jaminan'].'','Persetujuan','class="label label-warning" title="Persetujuan data surat jaminan"'); ?>
																<?php //echo anchor('surat_jaminan/delete/'.$row['kd_surat_jaminan'].'','Hapus','class="label label-danger" title="Hapus data surat jaminan" onClick="return confirm(\'Yakin ingin menghapus '.$row['nama'].' dari data surat jaminan?\');"'); ?>
															</span>
														</td>
													</tr>
													<?php 
												}
											}else{
										?>
										<tr>
											<td colspan="9" align="center">Tidak ada data</td>
										</tr>
										<?php
											}
										?>							
									</table>	
								</div>								
	            </div><!-- /.box-body -->
	            <div class="box-footer clearfix">
                <ul class="pagination pagination-sm no-margin pull-right">
                  <?php echo $pagination; ?>
                </ul>        
	            </div>
	        </div><!-- /.box -->                            
	    </div>
	</div>

	<script type="text/javascript">
	  $(document).ready(function(){
	    $('#tgl_awal, #tgl_akhir').datepicker({
	      dateFormat: "dd/mm/yy",
	      changeMonth: true,
	      changeYear: true
	    });
	  });
	</script>  